package org.chs.ts.batch.config;

import org.springframework.boot.actuate.health.Health;
import org.springframework.boot.actuate.health.HealthIndicator;
import org.springframework.stereotype.Component;

/**
 * @author wuwei
 * @date 2024/11/20
 * @apiNote 自定义邮件检测
 */
@Component
public class MailHealthIndicator implements HealthIndicator {

    @Override
    public Health health() {
        int errCode = check();
        if (errCode != 0) {
            return Health.down().withDetail("Error Code",errCode).build();
        }
        return Health.up().build();
    }

    int check(){
        // 可以实现自定义的数据库检测逻辑
        return 0;
    }
}
